﻿#include "FITKAbaAmplitudePeriodic.h"


Interface::FITKAbaAbstractAmplitude::FITKAbaAmplitudeType Interface::FITKAbaAmplitudePeriodic::getAmplitudeType() const
{
    return FITKAbaAmplitudeType::Periodic;
}

bool Interface::FITKAbaAmplitudePeriodic::copy(FITKAbstractDataObject *obj)
{
    FITKAbaAmplitudePeriodic* periodic = dynamic_cast<FITKAbaAmplitudePeriodic*>(obj);
    if (periodic == nullptr)
        return false;
    this->setDataObjectName(periodic->getDataObjectName());
    this->m_data = periodic->m_data;
}

Interface::FITKAbaAbstractAmplitude::TimeSpan Interface::FITKAbaAmplitudePeriodic::getTimeSpan() const
{
    return m_data.getTimeSpan();
}

void Interface::FITKAbaAmplitudePeriodic::setTimeSpan(FITKAbaAbstractAmplitude::TimeSpan type)
{
    m_data.setTimeSpan(type);
}

double Interface::FITKAbaAmplitudePeriodic::getCircularFrequency() const
{
    return m_data.getCircularFrequency();
}

void Interface::FITKAbaAmplitudePeriodic::setCircularFrequency(double value)
{
    m_data.setCircularFrequency(value);
}

double Interface::FITKAbaAmplitudePeriodic::getStartingTime() const
{
    return m_data.getStartingTime();
}

void Interface::FITKAbaAmplitudePeriodic::setStartingTime(double time)
{
    m_data.setStartingTime(time);
}

double Interface::FITKAbaAmplitudePeriodic::getInitialAmplitude() const
{
    return m_data.getInitialAmplitude();
}

void Interface::FITKAbaAmplitudePeriodic::setInitialAmplitude(double value)
{
    m_data.setInitialAmplitude(value);
}

int Interface::FITKAbaAmplitudePeriodic::getNumberOfRows() const
{
    return m_data.getNumberOfRows();
}

void Interface::FITKAbaAmplitudePeriodic::setNumberOfRows(int num)
{
    m_data.setNumberOfRows(num);
}

void Interface::FITKAbaAmplitudePeriodic::insertRow(int index)
{
    m_data.insertRow(index);
}

void Interface::FITKAbaAmplitudePeriodic::removeRow(int index)
{
    m_data.removeRow(index);
}

double Interface::FITKAbaAmplitudePeriodic::getA(int index) const
{
    return m_data.getA(index);
}

void Interface::FITKAbaAmplitudePeriodic::setA(double value, int index)
{
    m_data.setA(value, index);
}

double Interface::FITKAbaAmplitudePeriodic::getB(int index) const
{
    return m_data.getB(index);
}

void Interface::FITKAbaAmplitudePeriodic::setB(double value, int index)
{
    m_data.setB(value, index);
}

Interface::FITKAbaAbstractAmplitude::TimeSpan Interface::AmplitudePeriodicData::getTimeSpan() const
{
    return m_timeSpan;
}

void Interface::AmplitudePeriodicData::setTimeSpan(FITKAbaAbstractAmplitude::TimeSpan type)
{
    m_timeSpan = type;
}

double Interface::AmplitudePeriodicData::getCircularFrequency() const
{
    return m_circularFrequency;
}

void Interface::AmplitudePeriodicData::setCircularFrequency(double value)
{
    m_circularFrequency = value;
}

double Interface::AmplitudePeriodicData::getStartingTime() const
{
    return m_startingTime;
}

void Interface::AmplitudePeriodicData::setStartingTime(double time)
{
    m_startingTime = time;
}

double Interface::AmplitudePeriodicData::getInitialAmplitude() const
{
    return m_initialAmplitude;
}

void Interface::AmplitudePeriodicData::setInitialAmplitude(double value)
{
    m_initialAmplitude = value;
}

int Interface::AmplitudePeriodicData::getNumberOfRows() const
{
    return m_data.size();
}

void Interface::AmplitudePeriodicData::setNumberOfRows(int num)
{
    m_data.resize(num);
}

void Interface::AmplitudePeriodicData::insertRow(int index)
{
    m_data.insert(index, QPair<double, double>{});
}

void Interface::AmplitudePeriodicData::removeRow(int index)
{
    if (index >= 0 && index < m_data.size())
        m_data.removeAt(index);
}

double Interface::AmplitudePeriodicData::getA(int index) const
{
    if (index >= 0 && index < m_data.size())
        return m_data[index].first;
    return 0.0;
}

void Interface::AmplitudePeriodicData::setA(double value, int index)
{
    if (index >= 0 && index < m_data.size())
        m_data[index].first = value;
}

double Interface::AmplitudePeriodicData::getB(int index) const
{
    if (index >= 0 && index < m_data.size())
        return m_data[index].second;
    return 0.0;
}

void Interface::AmplitudePeriodicData::setB(double value, int index)
{
    if (index >= 0 && index < m_data.size())
        m_data[index].second = value;
}
